<?php include_once($_SERVER['DOCUMENT_ROOT']."/controller/common/common_setting_unit.php");         // 引入通用的设置文件 ?>
<?php include_once($_SERVER['DOCUMENT_ROOT']."/controller/common/module/head.php"); // 引入通用的头部 ?>
<?php include_once("../controller/category_edit.php");                     // 当前页面的控制器 ?>
<?php include_once("module/mod-nkeditor.php");                     // 当前页面的控制器 ?>



<body>



    <?
    //==============================================================================
    //这里开始才是平常开发需要注重的部分，其余的基本不用理会
    //==============================================================================
    ?>

    <div id="window">



        <div class="detail-box">


            <ul class="detail-boxing">
                <form id="data_form" method="post" class="layui-form"
                      action ="category_edit_process.php?<? echo $url_parameter ?>"
                      enctype="multipart/form-data">

                    <input type="hidden"  name="nid" value="<? echo $data['nid']?>" >

                    <fieldset class="layui-elem-field layui-field-title" >
                        <legend>基本信息</legend>
                    </fieldset>

                    <blockquote class="layui-elem-quote">基本信息多数是对外使用的资料，请细心填写。</blockquote>
                    <br/>


                    <!--普通的input文本输入-->
                    <li class="layui-form-item name">
                        <label class="layui-form-label">名称：</label>
                        <div class="layui-input-block">
                            <input type="text" class="layui-input"  name="ai_name"  value="<? echo $data['name'] ?>">
                            <em class="notice">(<u style="color:red">*必填项目</u>, 填写标题) </em>
                        </div>
                    </li>


                    <li class="layui-form-item term"><label class="layui-form-label">所属分类：</label>

                        <div class="layui-input-block">

                            <select name="ai_parent_nid">


                                <option value="root"  <?if($data['category_level'] != 'level01'){echo "disabled";}?>
                                        selected='selected'
                                >根目录</option>


                                <?foreach ($category as $val)
                                {?>
                                    <option value="<?echo $val['nid']?>"
                                        <?if($val['nid'] == $data['parent_nid']) {echo "selected='selected'";}?>
                                        <?if($data['category_level'] != 'level02'){echo "disabled";}?>
                                    ><?echo $val['name']?></option>

                                    <?foreach ($val['level2'] as $val2)
                                    {?>
                                        <option value="<?echo $val2['nid']?>"
                                            <?if($val2['nid'] == $data['parent_nid']) {echo "selected='selected'";}?>
                                            <?if($data['category_level'] != 'level03'){echo "disabled";}?>
                                        ><?echo $val['name']?>><?echo $val2['name']?></option>

                                    <?;}?>
                                <?;}?>

                            </select>
                            <em class="explain">为保证数据结构，仅支持同级迁移。</em>
                        </div>
                    </li>


                    <!--普通的textarea多行文本输入-->
                    <li class="layui-form-item introduce">
                        <label class="layui-form-label">简介：</label>
                        <div class="layui-input-block">
                            <textarea class="layui-textarea" name="ai_introduce"  ><?echo  $data['introduce']?></textarea>
                            <em class="notice">(填写本文的概述)</em>
                        </div>
                    </li>

                    <!--异步上传：选择图片时候已经处理好文件上传-->
                    <li class="layui-form-item icon">
                        <label class="layui-form-label">图标：</label>
                        <div class="layui-input-block">
                            <? include("module/mod-icon-async-upload.php");?>
                        </div>
                    </li>

                    <!--富文本编辑框-->
                    <li class="layui-form-item detail">
                        <label class="layui-form-label">资料详情：</label>
                        <div class="layui-input-block">
                            <textarea name="ai_content" style="width:1200px;height:600px;visibility:hidden;"><? echo $data['content'] ?></textarea>
                            <em class="notice">(填写详细页面文字、图片等主体内容)</em>
                        </div>
                    </li>





                    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;" id="content3">
                        <legend>更多资料</legend>
                    </fieldset>

                    <br/>






                    <!--单选项-->
                    <li class="layui-form-item publish">
                        <label class="layui-form-label">发布状态：</label>
                        <div class="layui-input-block">
                            <input name='ai_publish_status' type='radio' value='发布' title="立即发布"
                                <? if ($data['publish_status'] == '发布') {echo "checked='checked'";} ?>/>
                            <input name='ai_publish_status' type='radio' value='隐藏' title="暂未发布"
                                <? if ($data['publish_status'] == '隐藏') {echo "checked='checked'";} ?>/>
                            <br class="clearfloat"/>
                            <em class="notice">(选择立即发布，以上信息才能在前台显示；选择暂未发布，只对以上信息进行保存，不在前台显示)</em>
                        </div>
                    </li>


                    <!--时间选择-->
                    <li class="layui-form-item inputtime">
                        <label class="layui-form-label">发布时间：</label>
                        <div class="layui-input-block">
                            <input type="text" class="laydate-icon laydate_time layui-input"
                                   name="ai_publish_date" autocomplete="off" required
                                   value="<? echo $data['publish_date']; ?>"
                            >
                            <em class="notice">(填写发布的时间)</em>
                        </div>
                    </li>





                    <div class="function">

                        <button class="layui-btn"  lay-submit type="submit" >立即提交</button>
                        <input type="reset" class="layui-btn" value="重置"/>
                    </div>



                </form>
            </ul>
        </div>
    </div>


    <?
    //==============================================================================
    //这里上面才是平常开发需要注重的部分，下面的基本不用理会，只有底部JS部分需要根据实际情况去加载
    //==============================================================================
    ?>



    <br class="clearfloat"/>
    <!--container-->
</div>




    <!--底部栏-->
    <?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?>


    <script>
        // 子页面里任意位置（例如 <script> 标签里）
        document.title = '修改:<? echo $data['name'] ?>';   // 先给自己起好标题
        if (parent && parent.layer) {
            // 找到自己在父页中的弹层 index
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.title(document.title, index);
        }
    </script>


</body>
</html>
